package com.activitiFlow.service.impl;

import java.util.List;

import org.activiti.engine.HistoryService;
import org.activiti.engine.history.HistoricProcessInstance;
import org.activiti.engine.history.HistoricTaskInstance;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.activitiFlow.service.IHistoryBiz;


@Service("historyBiz")
public class HistoryBizImpl implements IHistoryBiz {

	@Autowired
	private HistoryService historyService;
	
	@Override
	public HistoricProcessInstance queryHistoryProcessInstance(String bunessKey) {
		return historyService.createHistoricProcessInstanceQuery().processInstanceBusinessKey(bunessKey).singleResult();
	}
	
	@Override
	public List<HistoricTaskInstance> queryHistoryTask(String processInstanceId, String activiId) {
		return historyService.createHistoricTaskInstanceQuery().processInstanceId(processInstanceId).taskDefinitionKey(activiId).orderByTaskId().asc().list();
//		return historyService.createHistoricActivityInstanceQuery().processInstanceId(processInstanceId).activityId(activiId).orderByActivityId().asc().list();
	}
}
